import { GBox } from "../../../../../com/mui/containers/GBox";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { LoveTaskCommentResItem } from "./LoveTaskCommentResItem";
//class LoveTaskCommentResList
    
    export  class LoveTaskCommentResList /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._gbox = new GBox();
            this._gbox.x = 0;
            this._gbox.y = 0;
            this._gbox.direction = GBoxDirection.VERTICAL;
            addChild(this._gbox);
            return;
        }

        public updateData(arg1: Array<any>): void
        {
            var loc1=0;
            var loc3=null;
            var loc4=null;
            var loc2=arg1.length;
            while (loc1 < loc2) 
            {
                loc3 = arg1[loc1];
                (loc4 = ObjectPool.getObject(LoveTaskCommentResItem)).updateData(loc3);
                this._gbox.addChild(loc4);
                ++loc1;
            }
            this._gbox.invalidate();
            this._gbox.y = (100 - this.height) / 2;
            if (this._gbox.y < 0) 
            {
                this._gbox.y = 0;
            }
            return;
        }

        public dispose(): void
        {
            var loc1=null;
            while (this._gbox.numChildren > 0) 
            {
                loc1 = this._gbox.removeChildAt(0) as LoveTaskCommentResItem;
                loc1.dispose();
                ObjectPool.disposeObject(loc1, LoveTaskCommentResItem);
            }
            return;
        }

        public /* override */ get height(): number
        {
            return this._gbox.numChildren * 30;
        }

        /* internal */ /* var */_gbox: GBox;
    }
